import { Message, MessageBox } from 'element-ui'


export default function ({ isSuccess, content, errorMessage, errorCode, successMessage }) {
  return new Promise((resolve, reject) => {
    if (isSuccess && (content || successMessage)) {
      resolve(content, successMessage)
    } else {
      Message({ message: errorMessage || '服务异常！', type: 'error', duration: 3 * 1000 })
      reject({ errorMessage, errorCode })
    }
  })
}